home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9370 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.1 KB  |  48 lines

  1. Path: mail2news.demon.co.uk!parkbayl.demon.co.uk
  2. From: Martin Bayly <martin@parkbayl.demon.co.uk>
  3. Newsgroups: comp.lang.c++
  4. Subject: [Q] Template instantiation
  5. Date: Fri, 01 Mar 1996 12:14:50 GMT
  6. Organization: Park Bayly Ltd
  7. Message-ID: <37116784wnr@parkbayl.demon.co.uk>
  8. Reply-To: martin@parkbayl.demon.co.uk
  9. X-NNTP-Posting-Host: parkbayl.demon.co.uk
  10. X-Newsreader: Newswin Alpha 0.9
  11. X-Mail2News-Path: disperse.demon.co.uk!post.demon.co.uk!parkbayl.demon.co.uk
  12.  
  13. Can anyone tell me if its possible to instantiate a template with a class 
  14. that is in itself a template.
  15.  
  16. i.e. I have two classes
  17.  
  18. template <class T>
  19. class Node
  20. {
  21.     .. omitted..
  22. private:
  23.     T* nodeObject;
  24. };
  25.  
  26. template <class X>
  27. class Queue
  28. {
  29.     ... omitted ...
  30. private:
  31.     X* queueObject;
  32. };
  33.  
  34. Queue<Node<int>> myQueue;        // Crazy as it may seem 
  35.                 // this doesn't work
  36.  
  37. i.e. I want to instantiate a Queue object which holds pointers to Node 
  38. objects which hold pointers to ints.
  39.  
  40. Am I on another planet??!
  41.  
  42. -- 
  43. Martin Bayly
  44.  
  45. "I need a good blast!  Where's the wind?"
  46. --------------------------------------------------------
  47.  
  48.